package com.hoow.shakoow.extend

import android.annotation.SuppressLint
import android.content.Context
import androidx.core.content.ContextCompat
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.hoow.shakoow.R

@SuppressLint("QueryPermissionsNeeded")
fun SwipeRefreshLayout.buildRefreshConfigs(
    context: Context,
    listener: SwipeRefreshLayout.OnRefreshListener?
): SwipeRefreshLayout {
    setColorSchemeColors(
        ContextCompat.getColor(
            context,
            R.color.main_page_background
        ),
        ContextCompat.getColor(
            context,
            R.color.main_shaking_background
        )
    )
    setProgressBackgroundColorSchemeResource(
        R.color.white
    )

    //刷新
    setOnRefreshListener(listener)
    return this
}